package com.icangya.common.config;

import com.icangya.weixin.sdk.WeChatTask;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

//@Component
//@Order(value=500)
public class GameThread implements CommandLineRunner {


  private final org.slf4j.Logger logger = LoggerFactory.getLogger(this.getClass());
  @Override
  public void run(String... args) throws Exception {

    logger.info(">>>>>>>>>>>>>>>服务启动后执行，执行加载数据等操作 11111111 <<<<<<<<<<<<<");

    new Thread(new Runnable() {
      @Override
      public void run() {
          while (true){
            try {
              logger.info("js  access_token 开始刷新！");
//              WeChatTask.getToken_getTicket();
              logger.info("WeChatTask.JSAPI_TICKET===="+ WeChatTask.JSAPI_TICKET);
              logger.info("WeChatTask.ACCESS_TOKEN===="+ WeChatTask.ACCESS_TOKEN);
              Thread.sleep(1000 * 3600);

            } catch (Exception e) {
              e.printStackTrace();
            }
          }
      }
    }).start();

  }

}